package com.zfast.config.mapper;

import com.zfast.config.entity.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Classname AdminMapper
 * @Description None
 * @Date 2019/7/16 12:21
 * @Created by WDD
 */
public interface AdminMapper {
    @Select("select * from t_sys_user where username = #{username}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "roles", column = "id", javaType = List.class,
                    many = @Many(select = "com.zfast.config.mapper.RoleMapper.findByAdminId"))
    })
    User findByName(String username);
}
